﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.UI.DataVisualization.Charting;

/// <summary>
/// Descripción breve de Funciones_Tpos
/// </summary>
public class Funciones_Tpos
{
    public enum Tipo_Perspectiva 
    { 
        Financiera,
        Clientes,
        ProcesoInterno,
        Mejora
    }
    public enum Tipo_Grafico { Bar, Pie };
	public Funciones_Tpos()
	{
		//
		// TODO: Agregar aquí la lógica del constructor
		//
	}
    public void Grafico_Barras(Chart Chart1)
    {
        // Create new data series and set it's visual attributes
        Series series = new Series("Valor");
        series.ChartType = SeriesChartType.Spline;
        series.BorderWidth = 3;
        series.ShadowOffset = 2;

        // Populate new series with data
        series.Points.AddY(67);
        series.Points.AddY(57);
        series.Points.AddY(83);
        series.Points.AddY(23);
        series.Points.AddY(70);
        series.Points.AddY(60);
        series.Points.AddY(90);
        series.Points.AddY(200);

        // Create new data series and set it's visual attributes
        Series seriesmeta = new Series("Meta");
        seriesmeta.ChartType = SeriesChartType.Bubble;
        seriesmeta.BorderWidth = 3;
        seriesmeta.ShadowOffset = 2;

        // Populate new series with data
        seriesmeta.Points.AddY(67);
        seriesmeta.Points.AddY(80);
        seriesmeta.Points.AddY(70);
        seriesmeta.Points.AddY(10);
        seriesmeta.Points.AddY(20);
        seriesmeta.Points.AddY(90);
        seriesmeta.Points.AddY(50);
        seriesmeta.Points.AddY(100);
        seriesmeta.Points.AddY(180);
        // Add series into the chart's series collection
        Chart1.Series.Clear();
        Chart1.Series.Add(series);
        Chart1.Series.Add(seriesmeta);
    }

    public void Grafico_pie(Chart Chart1, string Titulo)
    {
        this.Grafico_pie(Chart1, Titulo, true);
    }

    public void Grafico_pie(Chart Chart1,string Titulo,bool etiqueta)
    {
        // Populate series data
        double[] yValues = { 65.62, 75.54, 60.45, 55.73, 70.42 };
        string[] xValues = { "France", "Canada", "UK", "USA", "Italy" };
        Chart1.Series["Default"].Points.DataBindXY(xValues, yValues);
        Chart1.Series["Default"].ChartType = SeriesChartType.Pie;
        if (etiqueta)
            Chart1.Series["Default"]["PieLabelStyle"] = "Inside";

        // Set chart type and title
        Chart1.Series["Default"].ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), "Pie", true);
       
        // Set labels style
        if (etiqueta)
            Chart1.Series["Default"]["PieLabelStyle"] = "Outside";

        // Explode selected country
        foreach (DataPoint point in Chart1.Series["Default"].Points)
        {
            point["Exploded"] = "false";
            point["Exploded"] = "true";
        }

        // Enable 3D
        Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
        if (etiqueta)
            Chart1.Series[0]["PieDrawingStyle"] = Titulo;
        
        if (etiqueta)
            Chart1.Legends[0].Enabled = true;
 
    }
    public void Carga_Datos(ListBox lstDatos)
    {
        lstDatos.Items.Add("VALOR1: 67");
        lstDatos.Items.Add("VALOR1: 80");
        lstDatos.Items.Add("VALOR1: 70");
        lstDatos.Items.Add("VALOR1: 10");
        lstDatos.Items.Add("VALOR1: 20");
        lstDatos.Items.Add("VALOR1: 90");
        lstDatos.Items.Add("VALOR1: 50");
        lstDatos.Items.Add("VALOR1: 100");
        lstDatos.Items.Add("VALOR1: 180");
 
    }
}
